<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <style>
        .title {
            text-align: center;
            color: red;
            font-size: 24px;
            font-family: '微软雅黑';
            margin: 20px;
        }
        .yueli {
            width: 350px;
            margin: auto;
            display: flex;
            flex-wrap: wrap;
        }
        .yueli > div {
            width: 50px;
            text-align: center;
            margin: 5px 0;
        }
        select {
            width: 150px;
            padding: 5px;
        }
    </style>
    <title>月历</title>
</head>
<body>
<?php
include_once "function.php";
$d=new DateTime();
$nowYear=$d->format('Y');
$nowMonth=$d->format('m');
$year=$_GET['year']??$nowYear;//要显示月历的年份
$month=$_GET['month']??$nowMonth;//要显示月历的月份
?>
<select onchange="location.href='?year='+value+'&month=<?=$month?>'">
    <?php
    for($i=$nowYear; $i>$nowYear-10;--$i){
        echo "\t<option".($i==$year?' selected':'').">$i</option>\n";
    }
    ?>
</select>
<select onchange="location.href='?year=<?=$year?>&month='+value">
    <?php
    for($i=1;$i<=12;$i++){
        echo "\t<option".($i==$month?' selected':'').">$i</option>\n";
    }
    $a=getYueLi($year,$month);
    ?>
</select>
<div class="title"><?=$year?>年<?=$month?>月</div>
<div class='yueli'>
    <?php
    foreach($a as $k=>$v){
        echo "\t<div>$v</div>\n";
    }
    ?>
</div>
</body>
</html>
